<template>
    <div class="loading-container" v-show="show">
      <div class="loading-mask"></div>
      <div class="loading-content">
        <div class="loading-animate"></div>
        <div class="loading-text1">{{text}}</div>
      </div>
    </div>
</template>

<script>
    export default {
        name: "loading",
        props: {
          show: {
            type:Boolean
          },
          text: {
            type: String,
            default: '正在加载中'
          }
        }
    }
</script>

<style scoped>
  .loading-container{
    position: relative;
    text-align: center;
  }
  .loading-mask{
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, .0);
    z-index: 1000;
  }
  .loading-content{
    position: fixed;
    left: 50%;
    top: 45%;
    z-index: 2000;
    transform: translate(-50%, -45%);
    text-align: center;
    color: #fff;
    width: 1rem;
    height: 1rem;
    background: rgba(0,0,0,0.6);
    border-radius: 4px;
  }
  .loading-content .loading-animate{
    display: inline-block;
    width: 40px;
    height: 40px;
    vertical-align: middle;
    margin: 25px 0 10px;
    animation: circleLoading 1s steps(12, end) infinite;
    background: transparent url("") no-repeat;;
    background-size: 100%;
  }
  .loading-content .loading-text1{
    font-size: 16px;
  }

  @-webkit-keyframes circleLoading {
    0%{
      transform: rotate3d(0, 0, 1, 0);
    }
    100%{
      transform: rotate3d(0, 0, 1, 360deg);
    }
  }
  @keyframes circleLoading {
    0%{
      transform: rotate3d(0, 0, 1, 0);
    }
    100%{
      transform: rotate3d(0, 0, 1, 360deg);
    }
  }
</style>
